package com.chinadci.smartcommunitysystembackstage.mapper;

import com.chinadci.smartcommunitysystembackstage.entity.*;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Code Duck
 * @since 2021-04-13
 */
public interface ScsRepairMapper extends BaseMapper<ScsRepair> {
    //显示所有报修列表
    @Select("select * from scs_repair where r_create_time like #{dz}")
    @Results({
            @Result(id = true,column = "r_id",property = "rId"),
            @Result(column = "r_goods",property = "rGoods"),
            @Result(column = "r_create_time",property = "rCreateTime"),
            @Result(column = "r_position",property = "rPosition"),
            @Result(column = "u_id",property = "user",many = @Many(select = "Selects")),
            @Result(column = "r_id",property = "scs", many = @Many(select = "Select"))
    })
    List<ScsRepair> Find(String dz);

    @Select("select * from scs_handle where h_id=#{h_id}")
    List<ScsHandle> Select(int id);

    @Select("select * from scs_user where u_id=#{u_id}")
    List<ScsUser> Selects(int id);
}
